package com.kermel.andromeda.action;

import android.content.Context;
import android.test.AndroidTestCase;

import com.kermel.andromeda.data.Alarm;
import com.kermel.andromeda.data.AlarmTest;

@SuppressWarnings("unused")
public class AlarmActionTest extends AndroidTestCase {
    private AlarmAction alarmAction;
    private Alarm alarmFixture;
    private Context context;
    
    protected void setUp() throws Exception {
        super.setUp();
        
        alarmFixture = AlarmTest.createAlarmFixture();
        alarmAction = new AlarmAction(alarmFixture, context);
        context = getContext();
        System.out.println();
    }
    
    private AlarmAction createEmptyAlarmAction() {
        return new AlarmAction(null, null);
    }

    protected void tearDown() throws Exception {
        alarmFixture = null;
        alarmAction = null;
        
        super.tearDown();
    }
    
    /** The class under test is deprecated, but not yet removed from source code repository. Once it has been removed, we'll lose this test as well.
     *  
    public void testThatWhenTheAlarmIsNullTheActionDoesNotThrowAnException() {
        boolean exceptionCaught = false;
        try {
            alarmAction = createEmptyAlarmAction();
            alarmAction.run();
        } catch (Exception e) {
            exceptionCaught = true;
        }
        
        assertFalse(exceptionCaught);
    }
    
    public void testThatAnAlarmThatIsNotEnabledHasNotExpiredWhenTriggered() {
        alarmFixture.enabled = false;
        alarmAction.run();
        assertFalse(alarmAction.isExpired());
    }
    
    public void testThanWhenTheAlarmHasBeenTriggeredTheActionIsExpired() {
        alarmAction.run();
        assertTrue(alarmAction.isExpired());
    }
    
    public void testThatIsAlarmReadyToBeTriggeredReturnsFalseForNullAlarm() {
        alarmAction = createEmptyAlarmAction();
        assertFalse(alarmAction.isAlarmReadyToBeTriggered());
    }
    
    public void testThatIsAlarmReadyToBeTriggeredReturnsFalseForDisabledAlarm() {
        alarmFixture.enabled = false;
        assertFalse(alarmAction.isAlarmReadyToBeTriggered());
    }
    
    public void testThatIsAlarmReadyToBeTriggeredReturnsTrueForAnAlarmThatIsNonNullAndEnabled() {
        alarmFixture.enabled = true;
        assertTrue(alarmAction.isAlarmReadyToBeTriggered());
    }
     */
    
}
